package com.google.code.p.odbcconnectionchecker;

import java.awt.PopupMenu;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.XMLEncoder;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.Serializable;

public class ConnectionCheckerSaveConfiguration implements ActionListener, Serializable{

	private static final long serialVersionUID = 1L;
	private PopupMenu popupMenu;
	
	public void actionPerformed(ActionEvent e) {

		XMLEncoder encoder;
		try {
			encoder = new XMLEncoder(new FileOutputStream(ConnectionChecker.getJarPath() + "popupMenu.xml"));
			encoder.writeObject(popupMenu);
			encoder.close();
		} catch (FileNotFoundException e1) {
			e1.printStackTrace();
		}

		System.exit(0);
	}
	
	public PopupMenu getPopupMenu() {
		return popupMenu;
	}

	public void setPopupMenu(PopupMenu popupMenu) {
		this.popupMenu = popupMenu;
	}

}
